package com.candy.thread3;

/**
 * @author donglin
 * @Title:
 * @类名: MyThread
 * @date 2020/5/29
 */
public class MyThread extends Thread {

    public MyThread(String name) {
        super(name);
    }

    @Override
    public void run() {
        for (int i = 0; i <10 ; i++) {
            System.out.println(i+":"+this.getName());
            try {
                if(i==3){
                    Thread.yield();
                }
                Thread.sleep(500);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }


        }
    }
}
